import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import GlobalLayout from '@/components/layouts/GlobalLayout.vue'
import examples from './examples'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'root',
    component: GlobalLayout,
    redirect: '/home',
    children: [
      {
        path: '/home',
        name: 'Home',
        meta: { title: '首页' },
        component: () => import(/* webpackChunkName: "home" */ '@/views/home/Home.vue')
      },
      ...examples
    ]
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router
